<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    * {
        padding: 0;
        margin: 0;
        box-sizing: border-box;
    }
    
    body {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background: linear-gradient(#141e30, #243b55);
    }
    
    .login {
        display: flex;
        flex-direction: column;
        align-items: center;
        width: 400px;
        padding: 40px;
        background-color: rgba(0, 0, 0, 0.2);
        box-shadow: 0 15px 25px rgba(0, 0, 0, 0.4);
    }
    
    .login .login_box {
        position: relative;
        width: 100%;
    }
    
    .login .login_box input {
        outline: none;
        border: none;
        width: 100%;
        padding: 10px 0;
        margin-bottom: 30px;
        color: #fff;
        font-size: 16px;
        border-bottom: 1px solid #fff;
        background-color: transparent;
    }
    
    .login .login_box label {
        position: absolute;
        padding: 10px 0;
        top: 0;
        left: 0;
        color: #fff;
        /* 不能被点击 */
        pointer-events: none;
        /* 动画过渡 */
        transition: all 0.5s;
    }
    /* 
        focus选择器是当input获得焦点时触发的样式
        + 是相邻兄弟选择器  去找与input相邻的兄弟label
     */
    /* 
        :valid 选择器是判断input框的内容是否合法，如果合法会执行下面属性代码，不合法就不会执行
     */
    
    .login .login_box input:focus+label,
    .login .login_box input:valid+label {
        top: -20px;
        color: #03e9f4;
        font-size: 14px;
    }
    
    .login a {
        overflow: hidden;
        position: relative;
        padding: 10px 20px;
        color: #03e9f4;
        /* 去除下划线 */
        text-decoration: none;
        /* 动画过渡 */
        transition: all 0.5s;
    }
    
    .login a:hover {
        color: #fff;
        border-radius: 5px;
        background-color: #03e9f4;
        box-shadow: 0 0 5px #03e9f4, 0 0 25px #03e9f4, 0 0 50px #03e9f4, 0 0 100px #03e9f4;
    }
    
    .login a span {
        position: absolute;
    }
    
    .login a span:first-child {
        top: 0;
        left: -100%;
        width: 100%;
        height: 2px;
        background: linear-gradient(to right, transparent, #03e9f4);
        /* 动画名称 时长 匀速运动 infinite无限次数运动 */
        animation: move1 1s linear infinite;
    }
    
    .login a span:nth-child(2) {
        right: 0;
        top: -100%;
        height: 100%;
        width: 2px;
        background: linear-gradient(transparent, #03e9f4);
        animation: move2 1s linear 0.25s infinite;
    }
    
    .login a span:nth-child(3) {
        bottom: 0;
        right: -100%;
        width: 100%;
        height: 2px;
        background: linear-gradient(to left, transparent, #03e9f4);
        animation: move3 1s linear 0.5s infinite;
    }
    
    .login a span:last-child {
        bottom: -100%;
        left: 0;
        height: 100%;
        width: 2px;
        background: linear-gradient(to top, transparent, #03e9f4);
        animation: move4 1s linear 0.75s infinite;
    }
    
    @keyframes move1 {
        0% {
            left: -100%;
        }
        50%,
        100% {
            left: 100%;
        }
    }
    
    @keyframes move2 {
        0% {
            top: -100%;
        }
        50%,
        100% {
            top: 100%;
        }
    }
    
    @keyframes move3 {
        0% {
            right: -100%;
        }
        50%,
        100% {
            right: 100%;
        }
    }
    
    @keyframes move4 {
        0% {
            bottom: -100%;
        }
        50%,
        100% {
            bottom: 100%;
        }
    }
</style>

<body>
    <div class="login">
        <h2>用户登录</h2>
        <div class="login_box">
            <input type="text" required="required" />
            <label for="">账号</label>
        </div>
        <div class="login_box">
            <input type="password" required="required">
            <label for="">密码</label>
        </div>
        <a href="">
            登录
            <span></span>
            <span></span>
            <span></span>
            <span></span>
        </a>
    </div>
</body>

</html>